package com.assignwork.vo;

import io.swagger.annotations.ApiModel;
import lombok.Data;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.DateUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springblade.core.tool.utils.Func;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * (WorkLineLogInfo)VO
 * @since 2024-05-28 11:01:02
 */
@Data
@ApiModel(value = "WorkLineLogInfoVO", description = "")
public class WorkLineLogInfoVO  {

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long planId;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long lineId;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long arrangeId;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long logId;

    private String loadTypeKey;
    private String loadTypeKeyName;

    private String packageBulkKey;
    private String packageBulkKeyName;

    private String cargoTypeStr;

    private String landWorkTypeKey;
    private String landWorkTypeKeyName;

    private Kv workPlace;
    private String workPlaceKey;
    private String workPlaceName;

    private String berthKey;
    private String berthName;

    private Kv cabin;
    private String cabinKey;
    private String cabinName;

//    private List<CargoCategoryVO> cargoList;
//    private Kv cargoType;
//    private String cargoTypeKey;
//    private String cargoTypeName;

    private String processKey;
    private String processKeyName;

    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    private LocalDateTime beginTime;

    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    private LocalDateTime endTime;

    private String remark;


    public String getEndTimeStr() {
        if (endTime != null) {
            return DateUtil.format(endTime, "HH:mm");
        }
        return "";
    }

    public String getBeginTimeStr() {
        if (beginTime != null) {
            return DateUtil.format(beginTime, "HH:mm");
        }
        return "";
    }

    public String getBeginEndTimeStr() {
        if (Func.isNotBlank(getBeginTimeStr()) && Func.isNotBlank(getEndTimeStr())) {
            return getBeginTimeStr() + "~" + getEndTimeStr();
        }

        return "";
    }
}

